package com.huayanginfo.saas.domain.share;

import com.huayanginfo.saas.domain.Activity;
import com.huayanginfo.saas.domain.Document;
import com.huayanginfo.saas.domain.Link;

public class ShareManager {
	
	private ShareManager() {
		throw new AssertionError();
	}
	
	private static final ShareType[] activityShare = new ShareType[] {ShareType.everyone, ShareType.task, ShareType.team, ShareType.individual};
	private static final ShareType[] documentShare = new ShareType[] {ShareType.everyone, ShareType.task, ShareType.team, ShareType.individual, ShareType.organization, ShareType.project};
	private static final ShareType[] linkShare = new ShareType[] {ShareType.everyone, ShareType.task, ShareType.team, ShareType.individual, ShareType.organization, ShareType.project};
	
	public static <T extends Shareable> ShareType[] getShareType(T t){
		if (t instanceof Activity) {
			return activityShare;
		} else if (t instanceof Document) {
			return documentShare;
		} else if (t instanceof Link) {
			return linkShare;
		} else {
			throw new IllegalArgumentException();
		}
	}
}
